<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Developer Studio">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>QuickStart Guide</TITLE>
</HEAD>
<BODY>

<H1>Getting Started</H1>

<H2>Compile the unaltered source code</H2>
<P>This is the first release and so far is known only to compile on a few
machine/os/compiler combinations.
Therefore you should first check that the
unaltered source code compiles on your machine. If it doesn't compile
<A HREF="mailto:welty@welty.netkonect.co.uk">email me</A>, I would like to get it to
work on more machines.</P>
<UL>
<LI>Download the source and put it in a single directory</LI>
<LI>Link your sockets library if needed</LI>
	<UL>
	<LI>MS VC++ on Windows link in wsock32.lib: Choose Project/Settings... from the menu,
		click "Link", choose Category: General,
		and add "wsock32.lib" where it says Object/Library Modules</LI>
	<LI>Using other compilers and operating systems you may need to link a sockets library
		as well (please email examples to me)</LI>
	</UL>
<LI><B>Windows users</B> must #define _WIN32</LI>
	<UL>
	<LI>MS VC does this automatically</LI>
	<LI>Other compilers may need to define this on the command line with e.g. -D_WIN32</LI>
	</UL>
<LI>Compile it, all files are needed.</LI>
<LI>GNU C users should see the <A HREF="GNUC_bugs.htm">GNU C compilation guide</A>.</LI>
</UL>


<H2>Connect to GGS</H2>

<UL>
<LI>In the file 'main.cpp' in the line</P>
<PRE>	if (err = gs.Login("greedy","password")) {</PRE>
<P>Make the first parameter your program's login (8 characters max), the second parameter your program's
password.</P></LI>
<LI>In the file 'ODKStream.cpp' in the line</P>
<PRE>	if (pmsg->sFrom=="n2") {</PRE>
<P>Change "n2" to your (human) login. This login
controls the program; when it tells the program something, 
the program issues it as a command to GGS.</P>
</LI>
<LI>Recompile and run the code. Your program should connect to GGS.
It should print the latest news.</LI>
<LI>Log on using your controller login. Tell your program 'ta 8 ant'.
It should challenge ant to a game of Reversi.</LI>
</UL>

<H2>Porting to ODK</H2>

<P>If you are adding your program to ODK the following troubleshooting guide may prove useful:</P>

<TABLE BORDER>
<TR><TD>Error</TD><TD>Multiply defined: istream (or any other C++ standard library object)</TD></TR>
<TR><TD>Issue</TD><TD>ODK requires new-style headers, e.g. &lt;iostream&gt; rather than the older &lt;iostream.h&gt;</TD></TR>
<TR><TD VALIGN=TOP>Solution</TD><TD>In your code, change <PRE>#include &lt;iostream.h&gt</PRE> To <PRE>#include &lt;iostream&gt
using namespace std;</TD></TR>
<TR></TR>
<TR><TD>Error</TD><TD>anything related to BLACK, WHITE, EMPTY, DUMMY</TD></TR>
<TR><TD>Issue</TD><TD>ODK defines the constants COsBoard::BLACK, etc. and you have #defined BLACK, etc.</TD></TR>
<TR><TD VALIGN=TOP>Solution</TD><TD>In your code, change <PRE>#define BLACK 1</PRE> to <PRE>const int BLACK=1;</PRE> which
	regards namespaces, is type-safe, and improves compiler error checking.</TD></TR>

</TABLE>

<H2>Basic modifications</H2>

<UL>
<LI>Replace the GetMove() function with your own, see <A HREF="GetMove.htm">GetMove</A>.</LI>
<LI>(optional) Insert an ODKStream::<A HREF="HandleOsRequestDelta.htm">HandleOsRequestDelta()</A>
	function to automatically accept or decline incoming match requests</LI>
<LI>(optional) Insert an ODKStream::<A HREF="HandleOsGameOver.htm">HandleOsGameOver()</A>
	function to learn from the game</LI>
<LI>(optional) Insert an ODKStream::<A HREF="HandleOsMatchDelta.htm">HandleOsMatchDelta()</A>
	function to do things when matches start and end</LI>
</UL>

<P>To send a command to Lion, you output to the stream. From within a message
handler you would say:
<PRE>
(*this) << "tell .chat Hello World!\n";
flush();
</PRE>
To send the message "Hello World!" to the chat channel. Don't forget the '\n' (needed by the GGS parser)
or the flush() which sends the message to GGS.</P>

<H2>Tips</H2>

<P>If your program doesn't have a learning book (i.e. learn from its mistakes in games)
try 'rand' games which have a random starting position.</P>
<P>To write a very strong program, check out the papers by Michael Buro.</P>
<P>In ODK arrays, index 1 is for white and 0 is for black. This allows you to use
game.pos.board.iMover as the index.</P>

</BODY>
</HTML>
